﻿using System;
using System.Collections.Generic;

namespace Toolkit.Web.Infastructure
{
    public interface IHtmlNode
    {
        string TagName
        {
            get;
        }

        string InnerHtml
        {
            get;
            set;
        }

        TagRenderMode RenderMode
        {
            get;
        }

        IList<IHtmlNode> Children
        {
            get;
        }

        IDictionary<string, string> Attributes
        {
            get;
        }

        Action<IViewComponentWriter> Template
        {
            get;
            set;
        }

        void ApplyTemplate(HtmlTemplate template);

        void ApplyTemplate<T>(HtmlTemplate<T> template, T dataItem) where T : class;

        void AppendTo(IHtmlNode parent);

        void Append(IHtmlNode child);

        void WriteTo(IViewComponentWriter writer);

        string ToString();

        void AddClass(params string[] classes);

        void AddStyle(string key, string value);

        void MergeAttribute(string key, string value, bool replaceExisting);

        void MergeAttributes<TKey, TValue>(IDictionary<TKey, TValue> values, bool replaceExisting);
    }
}
